package lamer;

import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;

import utils.IniFile;

import Logic.GamerParams;

public class Lamer {

	static JFrame mainFrame = null;
	public static GamerParams gamerParams = null;
	public static ImageFrame imageFrame;
	static JTabbedPane jtbMain = null;
	static JTabbedPane jtbInput = null;
	static JTabbedPane jtbLikelihood = null;
	
	static InputFrame inputFrame = new InputFrame();
	static LikelihoodFrame likelihoodFrame = new LikelihoodFrame();
	
	public Lamer() {
		mainFrame = new JFrame();

		gamerParams = new GamerParams();
		gamerParams.Load();
		ImageFrame.Fits2Bmp(LSettings.dataFile);
		ImageFrame.Normalize(LSettings.dataFile);
		
		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainFrame.setTitle("Lamer version " + gamerParams.version);
		mainFrame.setSize((int) gamerParams.screenSize.x,
				(int) gamerParams.screenSize.y);


		IniFile.SaveTextfile("result.txt", "");
		
		imageFrame = new ImageFrame();
		// This will center the JFrame in the middle of the screen
		mainFrame.setLocationRelativeTo(null);

		
		mainFrame.setLayout(new GridLayout(1, 2));
		mainFrame.add(imageFrame);
		
		jtbMain = new JTabbedPane();
		jtbInput = new JTabbedPane();
		jtbLikelihood = new JTabbedPane();
		
		jtbMain.addTab("Input", null, jtbInput, "Input");
		jtbMain.addTab("Likelihood", null, jtbLikelihood, "Input");

		jtbInput.addTab("Data", null, inputFrame,
				"Input/putput data");

		jtbLikelihood.addTab("Likelihood", null, likelihoodFrame,
				"Likelihood analysis");
		
		
		mainFrame.add(jtbMain);
		
		mainFrame.setVisible(true);
		
	}
	
}
